package
{
	import fl.controls.ProgressBar;
	
	import flash.display.Loader;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.events.ProgressEvent;
	import flash.net.URLRequest;
	
	[SWF(frameRate="30")]
	public class PreLoad extends Sprite
	{
		private var _mainSwf:Loader;
		private var _bar:ProgressBar;
		public function PreLoad()
		{
			_mainSwf = new Loader
			_bar = new ProgressBar;
			_bar.width = this.stage.stageWidth/3;
			_bar.x = this.stage.stageWidth/2 - _bar.width/2;
			_bar.y = this.stage.stageHeight/2 - _bar.height/2;
			_bar.source = _mainSwf.contentLoaderInfo;
			this.addEventListener(Event.RESIZE , resizeHandler);
			addChild(_bar);
			_mainSwf.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
			_mainSwf.load(new URLRequest("FuxMain.swf?269"));
		}
		
		protected function resizeHandler(event:Event):void
		{
			_bar.width = this.stage.stageWidth/3;
			_bar.x = this.stage.stageWidth/2 - _bar.width/2;
			_bar.y = this.stage.stageHeight/2 - _bar.height/2;
		}
		protected function completeHandler(event:Event):void
		{
			_mainSwf.contentLoaderInfo.removeEventListener(Event.COMPLETE, completeHandler);
			this.stage.addChild(_mainSwf.content);
			this.stage.removeChild(this);
			_mainSwf = null;
			_bar = null;
		}
	}
}